{% extends "myghtyboard/base.html" %}
{% load i18n %}
{% load fbc %}

{% block extra-title %}{% trans "Forum Index" %} :: Pisanie odpowiedzi do "{{ topic.name }}"{% endblock %}

{% block your-position %}
	<a href="/forum/">{% trans "Forum Index" %}</a>
	<span class="color-orange">»</span>
	<a href='/forum/forum/{{topic.forum.id}}/'>{{ topic.forum.name }}</a>
	<span class="color-orange">»</span>
	<a href="/forum/topic/1/{{ topic.id }}">{{ topic.name }}</a>
	<span class="color-orange">»</span>
	Pisz odpowiedź
{% endblock %}


{% block content %}
					<div>
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Pisz odpowiedź do tematu <q>{{ topic.name }}</q></span>
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <form method="post" action="/forum/add_post/{{ topic.id }}/" enctype="">
                                            <fieldset>
                                                <textarea class="height-260" name="text">{% if text %}{{ text }}{% else %}{{ quote_text }}{% endif %}</textarea>
                                                {% if form.text.errors %}<br />*** {{ form.text.errors|join:", " }}{% endif %}<br/>
                                                <strong>{% trans "Available Tags" %}</strong>: [b], [u], [i], [code]. [url], [img], [quote].
                                                    <p class="right">
                                                        <span class="button-border">
                                                            <input type="submit" name="save" value="{% trans "Add post" %}" />
                                                        </span>
                                                    </p>
                                            </fieldset>

                                        </form>
                                    </div>
                                </div>
                            </div>

{% for post in lastpost %}
                            <div class="box-shadow">
                                <div class="box">
                                {% if forloop.first %}
                                    <div class="box-header">
                                        <span class="box-header-title">

                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>{{ topic.name }} - Ostatnich 10 wpisów</span>
                                        </span>
                                    </div>
                                {% endif %}
                                    <div class="box-content">
                                        <div class="forum-post">
                                            {{ post.text|fbc|safe|urlizetrunc:"60"  }}
                                            {% comment %}
                                            <br />
                                            <br />

                                            <span class="color-orange">»</span> <strong>Załączniki</strong>
                                            <p class="attachment">
                                                <img alt="attachment" src="/site_media/css/gfx/attachment.gif" /><br />
                                                <span>1280x800, 211 KB</span><br/>
                                                <span>Ściągnięto 21 razy</span>
                                            </p>
											{% endcomment %}
                                        </div>
                                        <hr />
                                        <div class="line">
                                           <span class="button-border"><span class="date{% if post.new %} alert{% endif %} auto-date">{{ post.date|date:"d/m/Y, G:i" }}<br /></span></span>
                                            <span class="content">
                                                <strong>{{ post.author_system }}{% if perms.is_staff %} @{{ post.ip }}{% endif %}</strong><br />

                                            </span>
                                          {% if perms.add_post %}
											{% if opened %}							
                                            <span class="button-border buttons"><span class="button"><a href="/forum/add_post/{{ topic.id }}/{{ post.id }}/">{% trans "Reply with quote" %}</a></span></span>
											{% endif %}
										  {% endif %}           
										{% ifequal post.author_system.username user.username %}
											{% if opened %}
													<span class="button-border buttons"><span class="button"><a href="/forum/edit_post/{{ post.id }}/">{% trans "Edit this post" %}</a></span></span>
											{% endif %}
										{% else %}
											{% if perms.is_staff %}
												<span class="button-border buttons"><span class="button"><a href="/forum/edit_post/{{ post.id }}/">{% trans "Edit this post" %}</a></span></span>
											{% endif %}
										{% endifequal %}
										{% if perms.is_staff %}
											<span class="button-border buttons"><span class="button"><a href="/forum/delete_post/{{ post.id }}/{{ topic.id }}/" onclick="return confirm('{% trans "Delete This Post?" %}')">{% trans "Delete this post" %}</a></span></span>
										{% endif %}										                               
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!-- Temat Koniec -->
                      
{% endfor %}
</div>
{% endblock %}
